package com.zlc.common.core.role.service.impl;


import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.role.mapper.MayanPlatDataRoleConfigMapper;
import com.zlc.common.core.role.model.entity.MayanPlatDataRoleConfig;
import com.zlc.common.core.role.model.vo.MayanPlatDataRoleConfigVo;
import com.zlc.common.core.role.service.MayanPlatDataRoleConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author  zl
 * @date 2023-05-08 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MayanPlatDataRoleConfigServiceImpl extends BaseServiceImpl<MayanPlatDataRoleConfigMapper, MayanPlatDataRoleConfig, MayanPlatDataRoleConfigVo> implements MayanPlatDataRoleConfigService {

    @Override
    public List<MayanPlatDataRoleConfigVo> getByRoleCodeList(List<String> roleCodes) {
        if(ObjectUtil.isEmpty(roleCodes)){
            return new ArrayList<>();
        }
        return queryVoList(wrapper().in(MayanPlatDataRoleConfig::getRoleCode, roleCodes));
    }
}
